package com.xyw.code.common.core.constant;

import java.util.HashMap;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: xuyiwei
 * Date: 2020/2/2
 * Time: 下午1:19
 * Email: 1328312923@qq.com
 * Description: No Description
 **/
public enum IsDelEnum implements ConstantStatusInterface {
    DEL(1,"删除"),
    USE(0,"正常")
    ;

    final static Map<Integer,IsDelEnum> cache = new HashMap<>();

    static {
        for(IsDelEnum isDelEnum:IsDelEnum.values()){
            cache.put(isDelEnum.key,isDelEnum);
        }
    }

    private Integer key;
    private String desc;

    IsDelEnum(Integer key, String desc) {
        this.key = key;
        this.desc = desc;
    }

    public static IsDelEnum get(Integer key) {
        return cache.get(key);
    }

    public Integer getKey() {
        return key;
    }

    public String getDesc() {
        return desc;
    }

    public static String getDesc(Integer key) {
        IsDelEnum e = get(key);
        return e != null ? e.getDesc() : null;
    }
}
